package com.specdot.kraster.math;

public class Vector4 {
	public float x, y, z, w;
	
	public Vector4(float x, float y, float z, float w) {
		this.x = x;
		this.y = y;
		this.z = z;
		this.w = w;
	}
	
	public float length() {
		return (float) Math.sqrt(x * x + y * y + z * z + w * w);
	}
	
	public Vector4 normalized() {
		float revLength = 1 / length();
		return new Vector4(x * revLength, y * revLength, z * revLength, w * revLength);
	}
	
	public Vector4 copy() {
		return new Vector4(x, y, z, w);
	}
	
	public float dot(Vector4 rhs) {
		return x * rhs.x + y * rhs.y + z * rhs.z + w * rhs.w;
	}
}
